add missing <link> element to RSS feed generation

Andrew Cantino 10 lat temu
rodzic
commit
aba9be6b0b

+ 5 - 0
app/models/agents/data_output_agent.rb

@@ -71,6 +71,10 @@ module Agents
71 71
       options['template']['title'].presence || "#{name} Event Feed"
72 72
     end
73 73
 
74
+    def feed_link
75
+      options['template']['link'].presence || "https://#{ENV['DOMAIN']}"
76
+    end
77
+
74 78
     def feed_description
75 79
       options['template']['description'].presence || "A feed of Events received by the '#{name}' Huginn Agent"
76 80
     end
@@ -100,6 +104,7 @@ module Agents
100 104
             <channel>
101 105
              <title>#{feed_title.encode(:xml => :text)}</title>
102 106
              <description>#{feed_description.encode(:xml => :text)}</description>
107
+             <link>#{feed_link.encode(:xml => :text)}</link>
103 108
              <lastBuildDate>#{Time.now.rfc2822.to_s.encode(:xml => :text)}</lastBuildDate>
104 109
              <pubDate>#{Time.now.rfc2822.to_s.encode(:xml => :text)}</pubDate>
105 110
              <ttl>#{feed_ttl}</ttl>

+ 1 - 0
spec/models/agents/data_output_agent_spec.rb

@@ -109,6 +109,7 @@ describe Agents::DataOutputAgent do
109 109
           <channel>
110 110
            <title>XKCD comics as a feed</title>
111 111
            <description>This is a feed of recent XKCD comics, generated by Huginn</description>
112
+           <link>https://localhost:3000</link>
112 113
            <lastBuildDate>#{Time.now.rfc2822}</lastBuildDate>
113 114
            <pubDate>#{Time.now.rfc2822}</pubDate>
114 115
            <ttl>60</ttl>